# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=gmsynth.lv2
pkgver=0.5.2
pkgrel=1
pkgdesc="General MIDI LV2 Synth"
arch=(loong64 x86_64)
url="https://x42-plugins.com/x42/x42-gmsynth"
license=(GPL2)
groups=(pro-audio lv2-plugins)
depends=(glibc)
makedepends=(fluidsynth lv2)
checkdepends=(lv2lint)
options=(debug)
source=(
  $pkgname-$pkgver.tar.gz::https://github.com/x42/$pkgname/archive/v$pkgver.tar.gz
  $pkgname-0.5.1-use_system_fluidsynth.patch
)
sha512sums=('e2a6553e90dd8b6756b97b639e508dd193c3f8b3d853ba276390da1cc2741045c547e6e10431d7973462b848bb868837d52a75892ec0eb180e312af307e1b540'
            'a0f2a09a6a839c38dc3234a719a633eb221f2afca2a97bbecf17b7d0c8dc71befec3768b882deb20357d55186e81e342cad73eb5e08426a1e2108949d11b3cf2')
b2sums=('dccdd124b8870c663acdb88e0d500adcbd57b5e1f8e0a9648e3fbc02b7e42e5f040abf315a33c553c5be6bcba35ac39d983146519777f8a73edfec1eb3a6099b'
        'cb327b55536006a862540e769497d138a6815bbee83f9365f97778adf8c542f3ce49e83d07dd532e66c39ce57a4c1eedc79c982b8ac350f22311f9443f682954')

prepare() {
  # use system fluidsynth
  patch -Np1 -d $pkgname-$pkgver -i ../$pkgname-0.5.1-use_system_fluidsynth.patch
}

build() {
  make -C $pkgname-$pkgver
}

check() {
  cd $pkgname-$pkgver
  lv2lint -Mpack -I build "http://gareus.org/oss/lv2/gmsynth"
}

package() {
  depends+=(
    fluidsynth libfluidsynth.so
  )

  make DESTDIR="$pkgdir/" PREFIX=/usr install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}
